package concurrent;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class ScheduledThreadPoolDemo {
    public static void main(String[] args) {
        ScheduledExecutorService executorService = Executors.newScheduledThreadPool(10);

        executorService.schedule(() -> {
            System.out.println("begin");
        },5, TimeUnit.SECONDS);

        executorService.scheduleAtFixedRate((Runnable) () -> System.out.println("execute"),0,1,TimeUnit.SECONDS);
    }
}
